<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>KLIPSE: a simple and elegant online cljs compiler and evaluator</title>
        <link rel='shortcut icon' type='image/x-icon' href='img/klipse.png' />
        <link rel="stylesheet" type="text/css" href="css/codemirror.css">
    </head>
    <body>
      <pre><code class="eval-python">a=3</code></pre>
      <br/>
      <pre><code class="eval-python">print(a+5)</code></pre>
      <br/>
      <pre><code class="eval-python">def foo(n):
   return n + 2</code></pre>
      <br/>
      
      <pre><code class="eval-python">print(foo(8))</code></pre>
      <br/>
<pre><code class="eval-python">print(2+3)</code></pre>
<br/>
<pre><code class="eval-python">def factorial(n):
  if n == 0:
    return 1
  else:
    return n * factorial(n - 1)

print(factorial(5))</code></pre>
    <br/>
<pre><code class="eval-python">print [x + 1 for x in range(10)]</code></pre>
    </br>

<pre><code class="eval-python">print(factorial(6))
print(factorial(3))</code></pre>
    </br>

<pre><code class="eval-python">import turtle

def drawTriangle(points,color,myTurtle):
  myTurtle.fillcolor(color)
  myTurtle.up()
  myTurtle.goto(points[0][0],points[0][1])
  myTurtle.down()
  myTurtle.begin_fill()
  myTurtle.goto(points[1][0],points[1][1])
  myTurtle.goto(points[2][0],points[2][1])
  myTurtle.goto(points[0][0],points[0][1])
  myTurtle.end_fill()

def getMid(p1,p2):
  return ( (p1[0]+p2[0]) / 2, (p1[1] + p2[1]) / 2)

def sierpinski(points,degree,myTurtle):
  colormap = ['blue','red','green','white','yellow',
  'violet','orange']
  drawTriangle(points,colormap[degree],myTurtle)
  if degree > 0:
    sierpinski([points[0], getMid(points[0], points[1]), getMid(points[0], points[2])], degree-1, myTurtle)
    sierpinski([points[1], getMid(points[0], points[1]), getMid(points[1], points[2])], degree-1, myTurtle)
    sierpinski([points[2], getMid(points[2], points[1]), getMid(points[0], points[2])], degree-1, myTurtle)

def main():
  myTurtle = turtle.Turtle()
  myWin = turtle.Screen()
  myPoints = [[-100,-50],[0,100],[100,-50]]
  sierpinski(myPoints,3,myTurtle)
  #myWin.exitonclick()

main()
</code></pre>
    </br>

    Another one
<pre><code class="eval-python">import turtle

def drawTriangle(points,color,myTurtle):
  myTurtle.fillcolor(color)
  myTurtle.up()
  myTurtle.goto(points[0][0],points[0][1])
  myTurtle.down()
  myTurtle.begin_fill()
  myTurtle.goto(points[1][0],points[1][1])
  myTurtle.goto(points[2][0],points[2][1])
  myTurtle.goto(points[0][0],points[0][1])
  myTurtle.end_fill()

def getMid(p1,p2):
  return ( (p1[0]+p2[0]) / 2, (p1[1] + p2[1]) / 2)

def sierpinski(points,degree,myTurtle):
  colormap = ['blue','red','green','white','yellow',
  'violet','orange']
  drawTriangle(points,colormap[degree],myTurtle)
  if degree > 0:
    sierpinski([points[0], getMid(points[0], points[1]), getMid(points[0], points[2])], degree-1, myTurtle)
    sierpinski([points[1], getMid(points[0], points[1]), getMid(points[1], points[2])], degree-1, myTurtle)
    sierpinski([points[2], getMid(points[2], points[1]), getMid(points[0], points[2])], degree-1, myTurtle)

def main():
  myTurtle = turtle.Turtle()
  myWin = turtle.Screen()
  myPoints = [[-100,-50],[0,100],[100,-50]]
  sierpinski(myPoints,3,myTurtle)
  #myWin.exitonclick()

main()
</code></pre>
    </br>

    

    <div id="mycanvas"  styleaa="width:400px; height: 400px;border-style: solid;"></div>
    
    <script>
        window.klipse_settings = {
        eval_idle_msec: 100,
	selector_eval_js: '.js',
            selector_eval_python_client: '.eval-python'
        };
        </script>
        <script src="/cljs-out/dev-main.js"></script>
    </body>
</html>
